module playerlist;

import utils;


/*char[][][] playerList;*/ /*= [
	["Player1", "15", "150"],
	["Player1", "15", "150"],
	["Player1", "15", "150"],
	["Player1", "15", "150"],
];*/


alias char[][] Player;
alias Player[] Players;

class PlayerList {
private:
	// a list of players for each server
	Players[] list;

public:
	// should correspond to playertable.playerHeaders
	enum { NAME, SCORE, PING }

synchronized:
	Players opIndex(size_t serverIndex) { return list[serverIndex]; }
	void opCatAssign(Players players) { list ~= players; }

	void insertSorted(Players players)
	{
		list ~= players;  // FIXME: sort
	}

	size_t numPlayers(size_t serverIndex) { return list[serverIndex].length; }
	PlayerList clear() { list.length = 0; return this; }
	PlayerList sort() { list[playerIndex].sort; return this; }
	PlayerList reverse() { list.reverse; return this; }
}

